home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / prog / pbc23c.arj / EXTRACT.BAS < prev    next >
BASIC Source File  |  1994-03-13  |  1KB  |  30 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1994  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB Extract (St$, Delimiter$, Index%, Start%, SLen%)
  8.    Ind% = Index%
  9.    IF LEN(Delimiter$) > 0 AND Index% > 0 THEN
  10.       Start% = 1
  11.       DO
  12.          tmp% = INSTR(Start%, St$, Delimiter$)
  13.          Ind% = Ind% - 1
  14.          IF Ind% = 0 THEN
  15.             IF tmp% THEN
  16.                SLen% = tmp% - Start%
  17.             ELSE
  18.                SLen% = LEN(St$) - Start% + 1
  19.             END IF
  20.          ELSEIF tmp% = 0 THEN
  21.             SLen% = 0
  22.          ELSE
  23.             Start% = tmp% + LEN(Delimiter$)
  24.          END IF
  25.       LOOP UNTIL tmp% = 0 OR Ind% = 0
  26.    ELSE
  27.       SLen% = -1
  28.    END IF
  29. END SUB
  30.